package com.ylkj.cloud.controller;

import com.ylkj.cloud.model.User;
import org.apache.commons.lang.RandomStringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.IntStream;

@RestController
@RequestMapping("/user")
public class UserController {



    private List<User> users = new ArrayList<>();


    public UserController(){
        IntStream.range(1,10).forEach(i->users.add(new User().setId(i).setName(RandomStringUtils.randomAlphabetic(10))));
    }

    @GetMapping("/list")
    public List<User> list(){
        return users;
    }
}
